<?php
namespace App\Repositories\User;

use App\Exceptions\API\APIException;
use App\Exceptions\API\BadRequest;
use App\Models\User;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Pagination\Paginator;
use Symfony\Component\HttpKernel\Exception\HttpException;

class UserDBRepository implements UserRepository
{
    /**
     * @param UserFilter $userFilter
     * @return Paginator
     */
    public function getPaginator(UserFilter $userFilter)
    {
        $query = $this->getDBQuery($userFilter);

        return $query->paginate($userFilter->getPerPage());
    }

    protected function getDBQuery(UserFilter $userFilter)
    {
        /** @var Builder $billQuery */
        $userQuery = User::query();
//        $userQuery->where('id',1);
//        throw new BadRequest('aaa');
        return $userQuery;
    }
}
